#pragma once

// Exception class with message created from error code from AVIFile library - constants AVIERR_.
class AVIFileError : public common::Error
{
public:
	// On unrecognized error code returns NULL.
	static const tchar * GetMessage(HRESULT code);

	AVIFileError(HRESULT hr, const tstring &Msg = "", const tstring &file = _T(""), int a_Line = 0);
};

// Exception class with message created from error code from Video Compression Manager library - constants ICERR_.
class VCMError : public common::Error
{
public:
	// On unrecognized error code returns NULL.
	static const tchar * GetMessage(HRESULT code);

	VCMError(HRESULT hr, const tstring &Msg = "", const tstring &file = _T(""), int a_Line = 0);
};


class VideoCompressorPimpl;

class VideoCompressor
{
public:
	VideoCompressor();
	~VideoCompressor();

	void ResetCompression();
	bool ShowDialog(HWND parent, const char *title = NULL);

	void BeginFile(const char *filePath, const BITMAPINFOHEADER &srcFormat, unsigned fps, unsigned frameCount);
	void EndFile();
	void PostFrame(const void *data);

private:
	scoped_ptr<VideoCompressorPimpl> pimpl;
};
